<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <!-- 引入vue2的js文件 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.9/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <input type="text" v-focus />
    </div>

    <script>
      new Vue({
        el: '#app',
        directives: {
          /*
            el,binding
            */
          focus: {
            inserted(el) {
              //   console.log(el)
              el.focus()
            }
          }
        }
      })
    </script>
  </body>
</html>
